<?php

//$this->title = $this->escape($this->project['name']);
$this->headTitle("Registries");
?>
<div class="row">
   <div class="span8">
      <p><?=$this->task['description'] ?></p>
      <p><?php echo $this->status($this->task['st_description'], $this->task['st_css_badge']);?></p>
   </div>
   <div class="span4">
      <div class="btn-group pull-right">
         <a href="<?=$this->url(array('controller' => 'projects',
             'action' => 'show', 'id' => $this->task['project_id'])) ?>"
             class="btn btn-large" rel="tooltip" title="Back">
            <i class="icon-chevron-left"></i>
         </a>
         <a href="<?=$this->url(array('controller' => 'tasks',
             'action' => 'update',
             'id' => $this->task['id'],
             'project' => $this->task['project_id']), null, true) ?>"
             class="btn btn-large" rel="tooltip" title="Edit">
            <i class="icon-edit"></i>
         </a>
         <a href="<?= $this->url(array('controller' => 'registries',
            'action' => 'create', 'task' => $this->task['id']), null, true)
            ?>"
            class="btn btn-primary btn-large">
            <i class="icon-plus icon-white"></i> New Registry
         </a>
      </div>
      
   </div>
</div><br/>

<div class="row">
   <div class="span12">
      <?php if (sizeof($this->paginator)): ?>
      <table class="table table-striped table-bordered table-condensed">
         <thead>
            <tr>
               <th style="width: 50px;">#</th>
               <th>Description</th>
               <th style="width: 80px;">Created At</th>
               <th style="width: 80px;">Updated At</th>
               <th style="width: 100px;">&nbsp;</th>
            </tr>
         </thead>
         <tbody>
         <?php
         foreach($this->paginator as $registry) :
         ?>
            <tr>
               <td><?php echo $registry->id;?></td>
               <td>
                  <?php echo $registry->description;?>
               </td>
               <td><?php echo date('d/m/Y', strtotime($registry->created_at));?></td>
               <td><?php echo ($registry->updated_at != null ?
                       date('d/m/Y', strtotime($registry->updated_at)) : "");?></td>
               <td>
                  <div class="btn-group">
                     <a href="<?=$this->url(array('controller' => 'registries',
                           'action' => 'update', 'id' => $registry->id,
                           'task' => $this->task['id']), null, true)
                        ?>"
                        class="btn" rel="tooltip" title="Edit">
                        <i class="icon-edit"></i>
                     </a>
                  </div>
               </td>
            </tr>
         <?php endforeach; ?>
         </tbody>
      </table>
      <?php echo $this->paginator; ?>
      <?php else: ?>
      <div class="alert">
         No registries found.
      </div>
      <?php endif; ?>
   </div>
</div>
